﻿using ReflectionStudio.Core.Events;
using System;
using System.Data;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Media;
using System.Diagnostics;
using System.ComponentModel;
using WPFExcelReport.Helpers;
using System.Windows.Input;
namespace WPFExcelReport
{
    public partial class TSWT14
    {
        public TSWT14()
        {
            if (DesignerProperties.GetIsInDesignMode(this))
                return;
            MV = new VWTSAER();
            this.DataContext = MV;
            InitializeComponent();
        } 
        public override void LOADALL()
        {
            dwData = TBMain.NewRow();
            dwData["WTBMANDANT"] = app.Mandant;
            dwData["WTBCADKEY1"] = " AND WTBCADKEY1='"+ JWP.Trim().PadRight(13)+"'";
            SResult =TMV.QWT02(dwData);
            MergeData(SResult, false);
        }
        public override void ManageCommand(object sender, RoutedEventArgs e)
        {
            if (IsManage)
            {
                LOADALL();
            }
            else
            {
                if(JWP=="J")
                {
                    VICC_WFEVENTS.SVWF.WT15(this.RUNID, KEY);
                }

                if (JWP == "W")
                {
                    VICC_WFEVENTS.SVWF.WT10(this.RUNID, KEY);
                }

            }

            base.ManageCommand(sender, e);
        }
        public override void OnJWPChg()
        {
            LOADALL();
            base.OnJWPChg();
        } 
    }
}
